package com.ftg.learn.day10;

/**
 * 单例DCL
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/8/10 上午10:29
 */
public class Dcl {

    //引用类型的默认値为null
    private static volatile Dcl dcl;

    private Dcl() {

    }

    public static Dcl getInstance() {
        if (null == dcl) {
            synchronized (dcl) {
                if (null == dcl) {
                    dcl = new Dcl();
                }
            }
        }
        return dcl;
    }

}
